package com.huike.web.controller.report;


import com.huike.common.utils.DateUtils;

import com.huike.report.domain.vo.*;
import javafx.scene.input.DataFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;


    /**
     * 首页--基础数据统计
     *
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime) {
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime, endCreateTime));
    }

    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo() {
        IndexTodayInfoVO todayInfo = reportService.getTodayInfo();
        return AjaxResult.success(todayInfo);
    }

    @GetMapping("/getTodoInfo")
    public AjaxResult getToduInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime) {
        IndexTodoInfoVO IndexVo = reportService.getToduInfo(beginCreateTime, endCreateTime);
        return AjaxResult.success(IndexVo);
    }

//商机转化龙虎榜接口
    @GetMapping("/businessChangeStatistics")
    public AjaxResult getdragonlist(@RequestParam("beginCreateTime") String beginCreateTime,
                                    @RequestParam("endCreateTime") String endCreateTime) {
        List<BusinessChangeVO> list = reportService.getdragonlist(beginCreateTime, endCreateTime);
        return AjaxResult.success(list);
    }

//线索龙虎榜
@GetMapping("/salesStatistic")
    public AjaxResult getdragonlistclue(@RequestParam("beginCreateTime") String beginCreateTime,
                                        @RequestParam("endCreateTime") String endCreateTime){
    List<BusinessChangeVO> list = reportService.getdragonlistclue(beginCreateTime, endCreateTime);
    return AjaxResult.success(list);

}

}